-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete coverage for the qrcode package #12675
Conversation
This comment has been minimized.
This comment has been minimized.
d454e5b
to
50c3950
Compare
This comment has been minimized.
This comment has been minimized.
50c3950
to
8f08aae
Compare
This comment has been minimized.
This comment has been minimized.
8f08aae
to
f25f83b
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Not a complete review, but we require Any
s to be documented (either using a comment or using an appropriate type alias). I noticed that you added Any
annotations to a few kwargs
arguments which are - I suspect - forwarded to another function. In this case, we could copy the arguments over (or leave kwargs
unannotated for now).
I'll review these again and document where I can. I certainly may have missed some forwarded calls in this project. However, there are some bad practices in the codebase, like a ABCs with an empty (non-abstract) |
This comment has been minimized.
This comment has been minimized.
You could either remove them if you think that no valid code should call |
The project isn't that well structured, I am not confident enough to say it'll never be called with arguments. So I removed it from the type hints altogether. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, a few notes below, mostly around using IO
and its sub-classes. These are semi-deprecated in typeshed, especially in argument types, since these types are not protocols and very wide.
- Reflect forwarded arguments where I missed them before - Document the remaining Any arguments.
2a55ac7
to
3c8ed02
Compare
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
This PR covers all of the project. This library is somewhat underdocumented so
I erred on the side of covering all modules with public names.
Without this PR, the hints are partly broken; we have experienced these specific issues in production code:
QRCode()
overload fails to match when trying to use one of theqrcode.constants.ERROR_CORRECT_*
constants forerror_correction
and providing animage_factory
value, due to the use ofLiteral[]
RoundedModuleDrawer
radius_ratio
argument is incorrectly typed asint
(probably based on the default value, it should be afloat
).